<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加视频</title>
<include file="./Apps/BoxAdmin/View/Public/header.html" />
<script type="text/javascript" src="__AdminJs__/swfobject.js"></script>

</head>
<body>
 
    
 
        <div class="list_vmall_man">
        	<div class="list_vmall_le">
            	<!-- <p class="list_vmall_bin"><a href="<{:U('level')}>" target="_black">会员等级管理</a></p> -->
                  <include file="./Apps/BoxAdmin/View/Public/adminMenu.html" />
               
            </div>
            <div class="list_vmall_rig" >
          
  <section class="content">
        <div class="page-content">
            
    <div class="panel panel-default">
        <div class="panel-heading">
            添加视频            <a class="btn btn-primary btn-xs" href="<{:U('video')}>">返回列表</a>
        </div>
        <div class="panel-body">
            <form id="form" class="form-horizontal" action="<{:U('add_video')}>" autocomplete="off" method="post" novalidate="novalidate">
 
                <div class="form-group" id="subjectsetting_div">
                    <label class="col-sm-2 control-label">课程</label>
                    <div class="col-sm-7">
                        <input type="hidden" name="subjectid" value="<{$data.subjectid}>">
                        <div class="panel panel-default" style="margin-bottom: 0;">
                            <div id="business-wrapper" class="panel-body">
               				 <volist name="subject_list" id="vo">
                        		 <span class="subject <if condition="$data['subjectid'] eq $vo['subjectid']">active</if>" data-id="<{$vo['subjectid']}>" data-name="subjectid"><{$vo.subject}></span>               
						     </volist>
				            </div>
                        </div>
						<small class="help-block"></small>
                    </div>
                    <div class="col-sm-3">
                    </div>
                </div>
                <div class="form-group" id="subject_class_div">
                    <label class="col-sm-2 control-label">章节</label>
                    <div class="col-sm-7">
                        <input type="hidden" name="sectionid" value="<{$data.sectionid}>">
                        <div class="panel panel-default" style="margin-bottom: 0;">
                            <div id="chapter-wrapper" class="panel-body">
							<volist name="sections_list" id="vo">
                        		 <span class="btn btn-default section <if condition="$data['sectionid'] eq $vo['sectionid']">active</if>" data-id="<{$vo['sectionid']}>" data-name="sectionid"><{$vo.section}></span>               
						     </volist>
							
							</div>
                        </div>
						<small class="help-block"></small>
                    </div>
                    <div class="col-sm-3">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">标题</label>
                    <div class="col-sm-7">
                        <input type="text" name="title" class="form-control" value="<{$data.title}>">
                    </div>
                    <div class="col-sm-3">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">介绍</label>
                    <div class="col-sm-7">
                        <textarea class="form-control" style="resize: none;" name="description" id="" cols="30" rows="4"><{$data.description}></textarea>
                    </div>
                    <div class="col-sm-3">
                    </div>
                </div>
				<div class="form-group">
                    <label class="col-sm-2 control-label">类型</label>
                    <div class="col-sm-7">
                       <select name="type">
					   <option value="type"></option>
					   </select>
                    </div>
                    <div class="col-sm-3">
                    </div>
                </div>
				 <div class="form-group" id="choicebox">
                    <label class="col-sm-2 control-label">经验值</label>
                    <div class="col-sm-7">
                        <input type="text" name="xuebazi" value="<{$data.xuebazi}>" size="4" needle="needle" class="inline" autocomplete="off"> 
							 <span class="help-block">看视频获得经验值</span>
                    </div>
                     <div class="col-sm-3">
                    </div>
                </div>
                 <!--<div class="form-group">
                    <label class="col-sm-2 control-label">选择视频</label>
                    <div class="col-sm-7">
                        <a href="javascript:;" class="btn btn-default video-upload">选择视频文件<span class="up-swf-box" id="up-swf-box"><embed type="application/x-shockwave-flash" src="http://union.bokecc.com/flash/api/uploader.swf" width="82" height="34" style="undefined" id="uploadswf" name="uploadswf" quality="high" allowfullscreen="true" allowscriptaccess="always" wmode="transparent" flashvars="progress_interval=1&amp;notify_url="></span></a>
                        <a href="javascript:;" class="btn btn-primary disabled" id="start-upload">开始上传</a>
                        <div class="progress  video-progress" id="video-progress" style="display: none;">
                            <div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 0%">
                                <span></span>
                            </div>
                        </div>
                        <p class="form-control-static" id="upload-progress" style="display: none;"></p>
                    </div>
                    <div class="col-sm-3">
                    </div>
                </div>-->
				<div class="form-group">
                    <label class="col-sm-2 control-label">选择视频</label>
                    <div class="col-sm-7">
                        <a href="javascript:;" title="查看试题"   href="javascript:;" url="<{:U('Subject/select_video')}>" data-target="#modal" class="btn btn-default video-upload selfmodal">选择视频文件 </a>
                        
                    </div>
                    <div class="col-sm-3">
                    </div>
                </div>
				
                <div class="form-group">
                    <label class="col-sm-2 control-label"></label>
                    <div class="col-sm-7">
                        <p class="form-control-static">选中的视频:<div style="position:relative; width:300px"  id="selected-file"></div></p>
                    </div>
                    <div class="col-sm-3">
					
                    </div>
                </div>
				
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-7">
                        <button type="submit" onclick="check()" class="btn btn-primary">保存视频</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
<div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">视频列表</h4>
      </div>
      <div class="modal-body" id="ajax_page_body">
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" onclick="modal_confirm()">确定</button>
      </div>
    </div>
  </div>
</div>

<div class="modal fade" id="modal_video" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">视频播放</h4>
      </div>
      <div class="modal-body">
	  <div id="videoPlayer"></div>
      </div>
       
    </div>
  </div>
</div>


    <style type="text/css">
        /*CC视频上传按钮样式*/
        .video-upload{ position: relative; }
        .video-upload .up-swf-box embed{ position: absolute; top: -1px; left: -1px; }
        .video-progress { display: inline-block; margin-bottom: 0px; width: 200px; vertical-align: middle; }

        .video{ position: relative; }
        .video .play{ display: block; position: absolute; bottom: 10px; right: 10px; line-height: 20px; font-size: 22px; }
		#video_img img{ max-width:100%}
		#selected-file img{ max-width:200px}
    </style>
	<script type="text/javascript" charset="utf-8" src="http://cdn.aodianyun.com/lss/ckplayer/player.js"></script>
    <script type="text/javascript">

        //
        /* 选择课程 加载章节 */
        $('.subject').selectOne(function(ele, dataId, name){
            $.ajax({
                url:'/Subject/get_ajax_section',
                data:{ subjectid: dataId },
                success:function(data){
                    $('#chapter-wrapper').html(data);
					$('[name=sectionid]').val('');
                }
            });
			check();
        });

        /* 选择章节 */
        $('.section').selectOne(function(ele, dataId, name){check();});


      
         
    </script>
	<script>
 function check(){
	 var leng=$("#subjectsetting_div .active").length;
	 var leng2=$("#subject_class_div .active").length;
 
	 var flag=0;
	 if(leng==0){
	 	$("#subjectsetting_div").addClass("has-error");
		$("#subjectsetting_div").find(".help-block").html("请选择课程");
		flag=1;
	 }else{
	 	$("#subjectsetting_div").removeClass("has-error").addClass("has-success");
		$("#subjectsetting_div").find(".help-block").html("");
	 }
	  if(leng2==0){
	 	$("#subject_class_div").addClass("has-error");
		$("#subject_class_div").find(".help-block").html("请选择章节");
		flag=1;
	 }else{
	 	$("#subject_class_div").removeClass("has-error").addClass("has-success");
		$("#subject_class_div").find(".help-block").html("");
	 }

	 if(flag==1){
	 	return false;
	 }else{
	 	$(".form-horizontal").data('bootstrapValidator').resetForm();
	 	return true;
	 }
	 
	 
 }
$(function(){
    $(".form-horizontal").bootstrapValidator({
        message: '您填入的值不合法',
        fields:{
            title: {
                message: '标题',
                validators: {
                    notEmpty: {
                        message: '标题不能为空'
                    },
                }
            },
			  description: {
                message: '介绍',
                validators: {
                    notEmpty: {
                        message: '介绍不能为空'
                    },
                }
            },
			  price: {
                message: '价格',
                validators: {
                    notEmpty: {
                        message: '价格不能为空'
                    },
					greaterThan:{
                        value:0,
                        message: '价格不能小于0'
                    },
                }
            },
			 xuebazi: {
                message: '经验值',
                validators: {
                    notEmpty: {
                        message: '经验值不能为空'
                    },
					greaterThan:{
                        value:0,
                        message: '经验值不能小于0'
                    },
                }
            },
			  

        }
    });
	
 
});
 </script>

        </div>
    </section>
                
                </div>
            </div>
       
        
    </div>

 
     


     
 
</body>
</html>
